package com.laber.config;

import com.laber.interceptors.LoginInterceptor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;

//@Configuration
//@Slf4j
//public class WebMvcConfiguration extends WebMvcConfigurationSupport {
//
//    @Autowired
//    private LoginInterceptor loginInterceptor;
//
//    @Override
//    public void addInterceptors(InterceptorRegistry registry) {
//        log.info("注册登录拦截器2...");
//        //注册登录拦截器
//        //登录接口和注册接口不拦截
//        registry.addInterceptor(loginInterceptor).excludePathPatterns(
//                "/user/login",
//                "/user/register",
//                "/doc.html",
//                "/v3/**"  // knife4j相关放行
//        );
//    }
//
//    /**
//     * 设置静态资源映射
//     *
//     * @param registry
//     */
//    protected void addResourceHandlers(ResourceHandlerRegistry registry) {
//        log.info("开始设置静态资源映射...");
//        registry.addResourceHandler("/doc.html").addResourceLocations("classpath:/META-INF/resources/");
//        registry.addResourceHandler("/webjars/**").addResourceLocations("classpath:/META-INF/resources/webjars/");
//    }
//}